package com.ruoyi;

import com.ruoyi.common.exception.job.TaskException;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.service.SysConfigServiceImpl;
import com.ruoyi.service.SysDictTypeServiceImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;

/**
 * 启动程序
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@ServletComponentScan
@ComponentScan(value = {"com.tx06","com.ruoyi"},excludeFilters={
        @ComponentScan.Filter(type= FilterType.ASSIGNABLE_TYPE, value= RuoYiApplication.class)} )
public class RuoYiApplication
{
    public static void main(String[] args) throws TaskException {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(RuoYiApplication.class, args);
        init();
        System.out.println("(♥◠‿◠)ﾉﾞ  若依启动成功   ლ(´ڡ`ლ)ﾞ  \n" +
                " .-------.       ____     __        \n" +
                " |  _ _   \\      \\   \\   /  /    \n" +
                " | ( ' )  |       \\  _. /  '       \n" +
                " |(_ o _) /        _( )_ .'         \n" +
                " | (_,_).' __  ___(_ o _)'          \n" +
                " |  |\\ \\  |  ||   |(_,_)'         \n" +
                " |  | \\ `'   /|   `-'  /           \n" +
                " |  |  \\    /  \\      /           \n" +
                " ''-'   `'-'    `-..-'              ");
    }

    private static void init() throws TaskException {
        SysConfigServiceImpl configService = SpringUtils.getBean(SysConfigServiceImpl.class);
        SysDictTypeServiceImpl dictTypeService = SpringUtils.getBean(SysDictTypeServiceImpl.class);
        configService.init();
        dictTypeService.init();
    }
}
